package com.etc.springbootssm.controller;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ErrorController {

    /**
     * 异常测试
     * @return
     */
    @GetMapping("testerror")
    public String testerror(){
        System.out.println(1/0);
        return "testerror";
    }


    /**
     * 局部异常
     * @return
     */
    @ExceptionHandler(ArithmeticException.class)
    public String ArthException(){
        return "数学运算异常了";
    }
}
